/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package edu.upn.sigemfi.plt.be;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Administrador
 */
@Entity
@Table(name = "PLT_VINCULADO")
@NamedQueries({@NamedQuery(name = "Vinculado.findAll", query = "SELECT v FROM Vinculado v"),
@NamedQuery(name = "Vinculado.findByFidPersonaNatural", query = "SELECT v FROM Vinculado v WHERE v.vinculadoPK.fidPersonaNatural = :fidPersonaNatural"),
@NamedQuery(name = "Vinculado.findByFidPersonaVinculado", query = "SELECT v FROM Vinculado v WHERE v.vinculadoPK.fidPersonaVinculado = :fidPersonaVinculado"),
@NamedQuery(name = "Vinculado.findByFechaAsociacion", query = "SELECT v FROM Vinculado v WHERE v.fechaAsociacion = :fechaAsociacion"),
@NamedQuery(name = "Vinculado.findByParentesco", query = "SELECT v FROM Vinculado v WHERE v.parentesco = :parentesco")})
public class Vinculado implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected VinculadoPK vinculadoPK;
    @Column(name = "FECHA_ASOCIACION")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fechaAsociacion;
    @Enumerated(EnumType.STRING)
    @Column(name = "PARENTESCO")
    private ParentescoVinculado parentesco;

    public Vinculado() {
    }

    public Vinculado(VinculadoPK vinculadoPK) {
        this.vinculadoPK = vinculadoPK;
    }

    public Vinculado(long fidPersonaNatural, long fidPersonaVinculado) {
        this.vinculadoPK = new VinculadoPK(fidPersonaNatural, fidPersonaVinculado);
    }

    public VinculadoPK getVinculadoPK() {
        return vinculadoPK;
    }

    public void setVinculadoPK(VinculadoPK vinculadoPK) {
        this.vinculadoPK = vinculadoPK;
    }

    public Date getFechaAsociacion() {
        return fechaAsociacion;
    }

    public void setFechaAsociacion(Date fechaAsociacion) {
        this.fechaAsociacion = fechaAsociacion;
    }

    public ParentescoVinculado getParentesco() {
        return parentesco;
    }

    public void setParentesco(ParentescoVinculado parentesco) {
        this.parentesco = parentesco;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (vinculadoPK != null ? vinculadoPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Vinculado)) {
            return false;
        }
        Vinculado other = (Vinculado) object;
        if ((this.vinculadoPK == null && other.vinculadoPK != null) || (this.vinculadoPK != null && !this.vinculadoPK.equals(other.vinculadoPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "edu.upn.sigemfi.plt.be.Vinculado[vinculadoPK=" + vinculadoPK + "]";
    }

}
